/*
 * @Author: your name
 * @Date: 2021-08-25 16:15:21
 * @LastEditTime: 2021-09-10 09:03:06
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \musicapp\src\api\index.js
 */
import axios from 'axios'
let baseUrl = 'http://localhost:3000'
    // 获取轮播图的api，type：资源类型，对应以下类型
    // 默认为0，pc；1，android；2，iphone；3，ipad
export function getBanner(type = 0) {
    return axios.get(`${baseUrl}/banner?type=${type}`)
}

// 获取推荐歌单,可选参数limit:获取数量,默认为10
export function getMusicList(limit = 10) {
    return axios.get(`${baseUrl}/personalized?limit=${limit}`)
}

// 获取歌单的详情
export function getPlayListDetail(id) {
    return axios.get(`${baseUrl}/playlist/detail?id=${id}`)
}

// 获取歌词
export function getLyric(id) {
    return axios.get(`${baseUrl}/lyric?id=${id}`)
}

// 搜索歌曲
export function searchMusic(keyword) {
    return axios.get(`${baseUrl}/search?keywords=${keyword}`)
}

// 手机登录
export function phoneLogin(phone, password) {
    return axios.get(`${baseUrl}/login/cellphone?phone=${phone}&password=${password}`)
}

// 获取用户的详情
export function userDetail(uid) {
    return axios.get(`${baseUrl}/user/detail?uid=${uid}`)
}